/**
 * 
 */
layui.use([ 'form' ], function() {
	var form = layui.form, layer = layui.layer;
	/* 登陆验证 */
	form.on('submit(submit)', function() {
		var username = $("#L_username").val();
		var password = $("#L_pass").val();
		var vercode = $("#L_vercode").val();
		$.ajax({
			type : 'POST',
			url : '/manager/login.do',
			data : {
				username : username,
				password : password,
				vercode : vercode
			},
			success : function(resl) {
				if (resl == "success") {
					window.location.href = '/manager/successLoginRedirect.do';
				} else if(resl=="false"){
					layer.alert('用户名或密码错误', function(index){
						  location.reload();
						  layer.close(index);
						  return false;
						}); 
				}else if(resl=="wrongvercode"){
					layer.alert('验证码输入错误', function(index){
						  location.reload();
						  layer.close(index);
						  return false;
						}); 
				}
			}
		});
		return false;
	});
});